<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="com.scalar.chiptrack.operations.dataentry.forms.SortDataEntryForm,
                com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.adaptor.SortLotBinData,
                 java.util.ArrayList,
                 com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/sortDataEntry.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/sort_dataentry.js"></script>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0' onload="checkIfAllReleasesAreSelected()">
<script language="javascript">
errMsg = '';
var releaseListCount = 0;

function selectProcessType()
{
    var form = document.massUpdateReleasesForm;
	if( form.processType.value == '0' )
    {
        form.action.value = "massUpdateReleases";
	    form.submit();
	    return ;
    }
	form.action.value = "loadReleases";
	form.submit();
}


function finalSave()
{
    var form = document.massUpdateReleasesForm;
    var releasesSelected = 'false';
    var pa  = document.getElementById("message");
    for( var i = 0; i < releaseListCount; i++)
    {
        if( form['releasesList['+i+'].selected'].checked )
        {
            releasesSelected = 'true';
        }
    }
    if( releasesSelected == 'false' )
    {
        pa.innerHTML = "<li>Please select atleast one release"
        return;
    }
	form.action.value = "updateReleases";
	form.submit();
}

function checkAllReleases( checkAll )
{
    if( checkAll.checked )
    {
        for( var i = 0; i < releaseListCount; i++ )
        {
            document.massUpdateReleasesForm[ 'releasesList[' + i + '].selected' ].checked = true
        }
    }
    else
    {
        for( var i = 0; i < releaseListCount; i++ )
        {
            document.massUpdateReleasesForm[ 'releasesList[' + i + '].selected' ].checked = false
        }
    }
}

function checkIfAllReleasesAreSelected()
{
    var selectedReleasesCount = 0;
    for( var i = 0; i < releaseListCount; i++ )
    {
        if( document.massUpdateReleasesForm[ 'releasesList[' + i + '].selected' ].checked )
        {
            selectedReleasesCount++;
        }
    }
    if( selectedReleasesCount == releaseListCount && releaseListCount > 0 )
    {
        document.massUpdateReleasesForm.checkAll.checked = true;
    }
    else if ( releaseListCount > 0 )
    {
        document.massUpdateReleasesForm.checkAll.checked = false;
    }
}
// -- EnD --

</script>

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation start -->
<%@ include file="/jsp/operations/releaseMenu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
<html:form name="massUpdateReleasesForm"  type="com.scalar.chiptrack.operations.release.forms.MassUpdateReleasesForm" action="/massUpdateReleases">

<input type="hidden" name="action" value="">

<table border="0" width="90%" align="center">
<tr><td class="NArialW" colspan="5" align="center">Mass Update Releases</td></tr>
<tr><td colspan=5>&nbsp;</td></tr>
<tr><td colspan=5 class='NArialL'><B><FONT id="message" styleClass="NArialL" color='FF0000'></FONT></b></td></tr>
<tr><td colspan=5>
  <chiptrack:info styleClass="NArialL" />
  <chiptrack:errors styleClass="NArialL" />
  <chiptrack:messages type="info" styleClass="NArialL" />
</td></tr>
<logic:equal name="showMessage" value="TRUE">
    <tr><td colspan=5 align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></td></tr>
</logic:equal>

<tr><td>
<table border="0" width="90%" align=left>
<tr><td>
<table border="0" width="100%">
    <tr>
        <logic:present name="processTypes" scope="request">
            <td width="25%" class="NArialL">Process Type:</td>
            <td width="25%" class="NArialL">
            <html:select name="massUpdateReleasesForm" property="processType" styleClass="txfield" onchange="selectProcessType()" >
                <html:option value="0">Select Process  Type</html:option>
                <html:options collection="processTypes" property="value" labelProperty="label"/>
            </html:select>
            </td>
        </logic:present>
        <logic:notPresent name="partNumbers" scope="request">
            <td colspan='2' width="50%">&nbsp;</td>
        </logic:notPresent>
        <td colspan='2' width="50%">&nbsp;</td>
    </tr>
        <TR>
            <TD >&nbsp;</TD>
        </TR>
        <logic:present property="releasesList" name="massUpdateReleasesForm">
        <TR width="100%">
            <TD COLSPAN="4">
            <bean:define name="massUpdateReleasesForm" id="massUpdateReleasesFormTemp" type="com.scalar.chiptrack.operations.release.forms.MassUpdateReleasesForm"/>
                <TABLE border="0" width='100%'>
                    <TR class='NArialL' bgcolor="#993333" align='center'>
                        <TD><font color="#FFFFFF"><input type="checkbox" name="checkAll" class="txfield" onclick="checkAllReleases(this)"></font></TD>
                        <TD><font color="#FFFFFF">Release Number</font></TD>
                        <TD><font color="#FFFFFF">Release Date</font></TD>
                        <TD><font color="#FFFFFF">OPN</font></TD>
                        <TD><font color="#FFFFFF">Specification File/Revision Number</font></TD>
                    </TR>
                    <%
                        int idx = 0;
                    %>
                    <nested:iterate property="releasesList" type="com.scalar.chiptrack.operations.release.ReleaseWithSpecificationInfo">
                        <TR class='NArialL' align='center' bgcolor="<%=(idx%2 == 0 ? "#DEE1E2" : "#FFFFEE")%>">
                            <TD><nested:checkbox property="selected" styleClass="txfield" onclick="checkIfAllReleasesAreSelected()" /></TD>
                            <TD><nested:write property="releaseNumber" /></TD>
                            <TD><nested:write property="releaseDate" /></TD>
                            <TD><nested:write property="opn" /></TD>
                            <TD><nested:write property="specificationFile"/>/<nested:write property="revisionNo"/></TD>
                        </TR>
                        <%
                            idx++;
                        %>
                    </nested:iterate>
                    <SCRIPT>
                        releaseListCount    = <%=idx%>;
                    </SCRIPT>
                </TABLE>
            </TD>
        </TR>
        <TR>
            <TD >&nbsp;</TD>
        </TR>
        <TR width="100%">
            <TD COLSPAN="4" ALIGN="CENTER">
                <chiptrack:restrictedLink functionality='<%=Functionality.MASS_UPDATE%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:finalSave();' onmouseover="window.status='Click to Mass Update Releases';return true" onmouseout="window.status='';return true">
                    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" title="Click here to Save Binning Info"/>
                </chiptrack:restrictedLink>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              <a href="<%=chipTracContext%>/massUpdateReleases.do"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17"onmouseover="window.status='Click to Cancel Changes';return true" onmouseout="window.status='';return true" title="Click here to Cancel Changes"></a>

            </TD>
        </TR>
    </logic:present>
</table>
</td>
</tr>
<tr><td>

</td></tr>

</table>
</td></tr>

</table>
</html:form>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>